﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BestCode.Creds.Data;
using BestCode.Creds.Entities;

namespace BestCode.Creds.Business
{
    public class LayoutBusiness : BusinessBase<Layout>
    {
        private ILayoutDao dao = DataFactory.Current.GetLayoutDao();
        public LayoutBusiness()
        {
            setDao(dao);
        }

        public override ObservableCollection<Layout> SearchByFilter(string parameter)
        {
            return new ObservableCollection<Layout>(dao.GetByFilter(parameter));
        }

        public ObservableCollection<Layout> LoadByTemplateId(int templateId)
        {
           return new ObservableCollection<Layout>(dao.GetAll().Where(p=> p.Template.Id == templateId));
        }
    }
}
